

def length_of_longest_substring(str):
    used = {}
    max_length = start = 0
    for i,c in enumerate(str):
        if c in used and start <= used[c]:
            start = used[c]
        else:
            max_length = max(max_length,i-start+1)
        used[c] = i
        print(used,"======")
    return max_length


print(length_of_longest_substring("abcabcbb"))




